package com.mygdx.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;

/**
 * Created by 80002023 on 2016/7/26.
 */
public class MapTransferButton extends Actor {
    private Texture mTexture;
    private TextureRegion mLeft;
    private TextureRegion mRight;
    private int dir;


    public MapTransferButton(int dir) {
        this.dir = dir;
        mTexture = new Texture(Gdx.files.internal("controls.png"));
        TextureRegion[] split = new TextureRegion(mTexture).split(64, 64)[0];
        mLeft = split[0];
        mRight = split[1];
    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        if (dir == -1) {
            batch.draw(mLeft, 0, 0, 70, 70);
        } else {
            batch.draw(mRight, 70, 0, 70, 70);
        }
    }

    @Override
    public void clear() {
        super.clear();
        mTexture.dispose();

    }
}
